<?php 
class cls_serve_order extends cls_serve_base
{
	function check_if_related_data($customerid, $orderid)
	{
		$order_data = cls_data_base::get_instance($this->name);
		
		$result = $order_data->check_if_related_data($customerid, $orderid);
		
		return $result;
	}
	
	function get_all_order($customerid)
	{
		$order_data = cls_data_base::get_instance($this->name);
	
		$result = $order_data->get_all_order($customerid);
	
		if(!$result)
		{
			return return_info(false);
		}
		else
		{
			return return_info(true, $result);
		}
	}
	
	function get_order_detail($customerid, $orderid)
	{
		$related = $this->check_if_related_data($customerid, $orderid);
		if(!$related)
		{
			return return_info(false, "该订单不属于当前用户");
		}
		
		$order_data = cls_data_base::get_instance($this->name);
	
		$result = $order_data->get_order_detail($orderid);
	
		if(!$result)
		{
			return return_info(false);
		}
		else
		{
			return return_info(true, $result);
		}
	}
	
	function get_order_by_date_range($customerid, $start_time, $end_time)
	{
		$order_data = cls_data_base::get_instance($this->name);
	
		$result = $order_data->get_order_by_date_range($customerid, $start_time, $end_time);
	
		if(!$result)
		{
			return return_info(false);
		}
		else
		{
			return return_info(true, $result);
		}
	}
}
?>